<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>IDIS 工作室 | 后台登录</title>


    <link href="../css/bootstrap.min.css" rel="stylesheet">
    <link href="../css/style.css" rel="stylesheet">
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>
<body>
<div class="container">
        <div  class="loginStage">
            <form id="login_form" action=" " method="post">
                <div class="form-group login-group">
                    <h3>登录</h3>
                    <div class="login-data">
                        <label for="username">账号</label>
                        <input type="text" class="form-control" id="username" placeholder="请输入账号" name="username" autofocus>
                        <br/>
                        <label for="password">密码</label>
                        <input type="password" class="form-control" id="password" placeholder="请输入密码" name="password">
                        <br/>
                    </div>
                    <div class="login-data">
                        <label class="text-danger">${msg! }</label>
                    </div>
                </div>
                <div class="form-group login-btn">
                        <button id="login_btn" type="submit" class="btn btn-default">提交</button>
                </div>
            </form>
        </div>
</div>

<script src="https://cdn.bootcss.com/jquery/3.2.0/jquery.min.js"></script>
<script src="../js/bootstrap.min.js"></script>
<script charset="utf8" src="../layer/layer.js"></script>
<script>
    $(document).ready(function() {
    $("#login_btn").click(function(){
        var username = $.trim($("#username").val());
        var password = $.trim($("#password").val());
        if(username == ""){
            layer.msg('请输入账号!', {time: 1000});
            return false;
        }else if(password == ""){
            layer.msg('请输入密码!', {time: 1000});
            return false;
        }
        //ajax去服务器端校验
        var data= {username:username,password:password};

        $.ajax({
            type:"POST",
            url:"",  //接口
            data:data,
            dataType:'json',
            success:function(msg){
                //alert(msg);
                if(msg==1){
                    window.location.href = "/admin";  //登入成功页面链接
                }else{
                    window.location.href = "/admin";
                }
            }
        });
    });
    });
</script>







</body>
</html>